<div class="layui-layout layui-layout-admin" style="padding-left: 20px;">
    <div class="layui-row" style="margin-top: 20px;">

        <div class="layui-col-xs6 search_text">
            <form class="layui-form" action="" onsubmit="javascript:return false;">
                <div class="demoTable">
                    <div class="layui-inline" style="width: 40%">
                        <input class="layui-input" name="apiName" id="apiName" autocomplete="off" placeholder="机器码" >
                    </div>
                    <div class="layui-inline" style="width: 40%">
                        <input class="layui-input" name="num" id="num" autocomplete="off" placeholder="允许同时在线数" >
                    </div>
                    <button class="layui-btn" data-type="reload" id="reload">生成license</button>
                </div>
            </form>
        </div>
    </div>
    <div class="layui-row" style="margin-top: 20px;">
        <div class="layui-col-xs1 ">  </div>
        <div class="layui-col-xs10 ">
        <textarea  class="layui-textarea" readonly id="license">

        </textarea>
            </div>
            <div class="layui-col-xs1 ">  </div>
    </div>




</div>
<script>

    var $;
    layui.use(['form','element','layer','jquery',"code"],function(){
        var $ = layui.jquery;
        $("#reload").on("click",function() {
            if( !$('#apiName').val()){
                layer.msg("请输入机器码!!!")
            }
            if( !$('#num').val()){
                layer.msg("允许同时在线数")
            }
            //调用接口
            $.post('{{urlfor "PlmController.AjaxGenPdmLisence"}}',{ hostId:$('#apiName').val(),num:$('#num').val()}, function (out) {
                if (out.status == 0) {
                    $('#license').val(out.message)
                } else {
                    layer.msg(out.message)
                }
            }, "json");





        })

    })




</script>